#!/bin/bash

# 检查磁盘空间是否低于1GB
THRESHOLD=1000000 # 1GB in KB

df -h | grep -q ' /$'
if [ $? -eq 0 ]; then
    ROOT_USAGE=$(df -m / | awk '{ print $4 }' | sed 's/%//g')
    if [ $ROOT_USAGE -gt 90 ]; then
        echo "警告：根目录使用率超过90%"
    elif [ $(df -m / | awk '{ print $3 }') -lt $THRESHOLD ]; then
        echo "警告：根目录空间不足1GB"
    else
        echo "根目录空间充足"
    fi
else
    echo "无法获取磁盘空间信息"
fi